#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include "lib.h"

Pvoid_t ja=(PWord_t)NULL;
int main(int argc,char **argv)
{
	int i=load_dict();
	printf("%d lines loaded\n",i);
	i=load_chinese_stop_word();
	printf("%d lines loaded\n",i);
	unsigned char line[1024];
	unsigned char *o,*p;
	FILE *fp=fopen("ec.txt","r");
	while(!feof(fp))
	{
		memset(line,0,sizeof(line));
		fgets(line,1023,fp);
		if(line[strlen(line)-1] == '\n')
			line[strlen(line)-1]='\0';
		if(line[0] == '\0') continue;
		printf("%s\n",line);
		p=reverse_str(line);
		printf("%s\n",p);
		printf("----------------\n");
		printf("FMM\n");
		o=gbk_split(line,0);
		printf("%s\n",o);
		free(o);
		
		printf("----------------\n");
		printf("BMM\n");
		o=gbk_split(p,1);
		free(p);
		p=reverse_str(o);
		printf("%s\n",p);
		free(o);
		free(p);
		
	}
	free(stop_word);
	Word_t b;
	JHSFA(b,ja);
	printf("free'ed %d Bytes\n",b);
}
